import java.nio.ByteBuffer;

public class TestBtyeBufferRead {
    public static void main(String[] args) {
        ByteBuffer buffer = ByteBuffer.allocate(10);
        buffer.put(new byte[]{'a', 'b', 'c', 'd'});
        buffer.flip();

        buffer.get(new byte[4]);
        ByteBufferUtil.debugAll(buffer);
        buffer.rewind();
        ByteBufferUtil.debugAll(buffer);
        System.out.println(((char) buffer.get()));
        buffer.mark();
        System.out.println(((char) buffer.get()));
        System.out.println(((char) buffer.get()));
        buffer.reset();
        System.out.println(((char) buffer.get()));
    }
}
